import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class ContentTextWidget extends StatelessWidget {
  const ContentTextWidget({
    super.key,
    this.text = '',
    this.top = 20,
    this.content = '',
    this.icon = false,
    this.hintText = '请输入手机号',
    this.onTap,
    this.arrow = true,
  });

  final String hintText;
  final String text;
  final String content;
  final double? top;
  final bool icon;
  final Function? onTap;
  final bool arrow;

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () => onTap?.call(),
      child: Container(
        alignment: Alignment.center,
        height: 50.h,
        margin: EdgeInsets.only(top: top ?? 20.h),
        padding: EdgeInsets.only(left: 10.w, right: 10.w),
        decoration: BoxDecoration(
            color: const Color(0xFFF7F8F9),
            borderRadius: BorderRadius.circular(8),
            border: Border.all(color: const Color(0xffE9E9E9), width: 0)),
        child: Row(
          children: [
            Expanded(
              child: Container(
                padding: EdgeInsets.only(left: 10.h),
                alignment: Alignment.centerLeft,
                child: Text(
                  text.isEmpty ? hintText : text,
                  overflow: TextOverflow.ellipsis,
                  style: text.isEmpty
                      ? TextStyle(color: const Color(0xFF999999), fontSize: 14.sp)
                      : TextStyle(color: const Color(0xFF000000), fontSize: 14.sp),
                ),
              ),
            ),
            if (content.isNotEmpty)
              Padding(
                padding: const EdgeInsets.only(right: 8.0),
                child: Text(
                  content,
                  style: TextStyle(color: const Color(0xFF000000), fontSize: 14.sp),
                ),
              ),
            arrow == false
                ? const SizedBox()
                : (icon
                    ? const Icon(Icons.navigate_next_sharp, size: 20, color: Color(0xFF000000))
                    : Image.asset('assets/app/images/user_edit/user_edit_arrow_right.png', width: 10.w))
          ],
        ),
      ),
    );
  }
}
